<?PHP
	$userName = "root";
	$password = "group05";
	$database = "test";
	$server = "cg3002-05-z.comp.nus.edu.sg";
	$conn = mysql_connect($host, $db_username, $db_password) 
			or die ('Error Cannot Connect to MySQL');
	@mysql_select_db($database) or die( "Unable to select database");
	$query = mysql_query('SHOW TABLES', $conn);

	while($tableName = mysql_fetch_row($query))
	{
		echo "<div class='alert-info' align='center'>", $tableName[0], "</div>";
		$result = mysql_query('SHOW COLUMNS FROM '.$tableName[0]);
		
		if(mysql_num_rows($result)) 
		{
			echo '<table class="table table-condensed table-hover table-bordered">';
			echo "<thead><th>Attribute</th><th>Domain</th><th>Null</th><th>Key</th>
				  <th>Default</th><th>Others</th></tr></thead><tbody>";
			
			while($row = mysql_fetch_row($result)) 
			{
				echo '<tr>';
				foreach($row as $key => $value) 
					echo '<td>', $value, '</td>';
				echo '</tr>';
			}

			echo '</tbody></table>';
		}
	}	
?>